import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: YKH
 * Date: 2022-05-05
 * Time: 9:21
 * author:Partice
 */
public class Partice {
    public static void main(String[] args) {
        //面板需要先有创建窗口
        Frame frame = new Frame();
        //设置布局
       // frame.setLayout(null);
        //创建面板对象
        Panel panel1 = new Panel();;
        //对 frame设置坐标,长宽 背景颜色
        frame.setBounds(200,300,800,600);
        frame.setBackground(Color.white);

        //对panel设置初始位置、坐标、颜色相对于frame
        panel1.setBounds(1,1,100,600);
        panel1.setBackground(new Color(1,1,1));
        frame.add(panel1,BorderLayout.WEST);


        Button button1 = new Button("botton1");
        Button button2 = new Button("botton2");
        Button button3 = new Button("botton3");
        Button button4 = new Button("botton4");
        Button button5 = new Button("botton5");
        Button button6 = new Button("botton6");
        frame.add(button1);
        frame.add(button2);
        frame.add(button3);
        frame.add(button4);
        frame.add(button5);
        frame.add(button6);
        frame.setLayout(new GridLayout(3,2));
        frame.setVisible(true);


        //创建面板对象
        Panel panel2 = new Panel();;
        //对 frame设置坐标,长宽 背景颜色
        frame.setBounds(200,300,800,600);
        frame.setBackground(Color.white);

        //对panel设置初始位置、坐标、颜色相对于frame
        panel2.setBounds(200,300,100,600);
        panel2.setBackground(new Color(1,1,1));
        frame.add(panel2,BorderLayout.EAST);

        //设置监听,关闭窗口
        frame.addWindowListener(new WindowAdapter() {
            //窗口点击时关闭窗口
            @Override
            public void windowClosing(WindowEvent e) {
                //结束程序
                System.exit(0);
            }
        });
    }
}
